package com.xinqi.modules.sys.config.factory;

import com.xinqi.common.base.error.CommonErrors;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.sys.config.client.SysConfigClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author：yyzhen
 * @Package：com.xinqi.modules.sys.config.factory
 * @Project：com.xinqi.-Cloud-Plus
 * @name：SysConfigFallbackFactory
 * @Date：2023/6/15 20:06
 * @Filename：SysConfigFallbackFactory
 */
@Slf4j
@Component
public class SysConfigFallbackFactory implements FallbackFactory<SysConfigClient> {
    @Override
    public SysConfigClient create(Throwable cause) {
        return new SysConfigClient() {
            @Override
            public R<String> getConfigKey(String configKey) {
                return R.error(CommonErrors.INTERNAL_SERVER_ERROR.getCode(), null);
            }
        };
    }
}
